<?php 
/**
 * Template Name: Home
 * 
 */
?>


<?php get_header(); ?>

	<!--banner-->
   <section class="banner">
    	<div class="slider-wrapper theme-default">
            <?php echo do_shortcode('[uds-billboard name="billboard"]')?>
        </div>
  </section>
    
    <!-- content -->
    <section class="main">
		<nav class="main-nav">
			<ul>						
				<?php 
					$taxonomies = 'building-type';
					$args  = array('hide_empty'=>false);
					$terms = get_terms( $taxonomies, $args ) ;
					foreach($terms as $term){							
						if( $term->parent == 0 && get_tax_meta($term->term_id,'building_tax_show_home') == 1){
							?>
						<li <?php echo checkActiveMenuHome($term->term_id)?>><a href="<?php echo get_term_link($term,$taxonomies);?>"><?php echo $term->name;?></a></li>
						<li class="line-nav"></li>
					<?php
						}
					}
				?>
				<?php $pageid = 58 ;if(ICL_LANGUAGE_CODE == 'vi') $pageid = 76 ;?>
			   <li><a href="<?php echo get_page_link($pageid)?>">
					<?php echo get_page($pageid)->post_title; ?>
				</a></li>
			</ul>
		</nav>
    	<?php get_sidebar(); ?>
        
        <!-- main content -->
        <section class="main-content">
        	<section class="main-top">            	
                <div class="block-about">
                    <h2 class="title"><strong><?php _e('WELLCOME','building')?></strong> <?php _e('TO OUR WEBSITE','building')?></h2>
					<?php
						global $post ;
						$mypost = get_posts('numberpost=1&cat=14');
						foreach($mypost as $post):
							setup_postdata($post);
					?>
						<div class="block-content">
							<?php if(has_post_thumbnail()) :?>
								<h4 class="about-image"><?php the_post_thumbnail();?></h4>
							<?php endif;?>	
							<div class="about-cont">
								<h3 class="about-title"><?php the_title();?></h3>
								<?php the_content();?>
							</div>
							<div class="clear"></div>
						</div>
					<?php endforeach;?>
                    
                </div>
            </section>
            <div class="block-pro">
				<h2 class="pro-title"><span class="head-tit"><span><?php _e('Hot Property','building')?></span></span><a class="tit-link" href="<?php bloginfo('url')?>/building/"></a></h2>            	
                <?php echo do_shortcode('[building_featured per_page="4" columns="4"]');?>
                <div class="clear"></div>
            </div>
            <?php
				$taxonomies = 'building-type';
				$args  = array('hide_empty'=>true);
				$terms = get_terms( $taxonomies, $args ) ;
				foreach( $terms as $term ):
					if( $term->parent == 0 && get_tax_meta($term->term_id,'building_tax_show_home') == 1){
			?>	
	<?php $arrayPost = get_posts(array('suppress_filters'=>0,'post_type'=>'building','numberposts'=>-1,'tax_query'=> array(array( 'taxonomy' => $taxonomies ,'field'=>'id','terms'=>$term->term_id ))));
				if(count($arrayPost) > 0){
	?>
				 <div class="block-pro">
					<h2 class="pro-title">
						<span class="head-tit">
							<span><?php echo $term->name;?></span>
						</span>
						<a href="<?php echo get_term_link($term,$taxonomies);?>" class="tit-link"></a>
					</h2>					
					<?php echo do_shortcode('[building_category per_page=4 columns="4" category="'.$term->term_id.'"]');?>
					<div class="clear"></div>
				</div>
			<?php 
					}
				}
				endforeach;?>            
        </section>
        <!-- end main content -->
        <div class="clear"></div>
    </section>
    <!-- content -->

<?php get_footer(); ?>